/*
 * serial.h
 *
 *  Created on: Apr 2, 2012
 *      Author: Tri_D
 */

#ifndef SERIAL_H_
#define SERIAL_H_

#include "main header.h"
#include "queue.h"


#define		MAX_TX_CHAR_SIZE		100		
#define		MAX_SER_PKG_SIZE		32

typedef enum _Serial_State
{
	TX_SER_READY = 0,
	TX_SER_NOT_READY
} Ser_State;




typedef struct _Serial
{
	que_512 Rx;						// Receive queue	
	uint8_t Tx[MAX_TX_CHAR_SIZE];	// Transmit buffer
	uint8_t Ptr;					// Pointer for transmit buffer
	uint8_t Size;					// Size of the current packet in Tx buffer
	Ser_State Flag; 				// current state of serial transmit	
} Serial_t;

void Ser_Init(Serial_t * pS);
void Tx_Ser(Serial_t * pS, uint8_t * data, uint8_t size);


#endif /* SERIAL_H_ */
